<?php die("Your website is temporarily disabled to warn you that the current version of the framework (XenonPHP) is deprecated and the repository will soon be replaced by a new version with a completely different structure. To remove this message and reactivate your website, go to libs/core/xenon.php and remove the first line. Then do not update the Framework anymore. To try the new version of the Framework, it is available in branches/v2.");?>
<?php
define('X_AJAX',!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH'])=='xmlhttprequest');

require_once 'config.php';
if(X_config::$_session_AutoStart)session_start();

abstract class X{
    
    
}
class X_options{
    public static $plugins= array();
    public static $mvcPlugins= array();
    public static $mvc= false;
    public static $ajaxmvc= false;
    public static $stream= false;
    public static $mysql_connections= array();
    public static function mysql_getLastConnectionLink(){
        $link= null;
        foreach(X_options::$mysql_connections as $conn){
            if($conn)$link= $conn->link;
        }
        return $link;
    }
    public static $i18n=null;
    
}
class X_exception extends Exception{
    public function __construct($message, $code, $previous) {
        //parent::__construct($message, $code, $previous);
    }
}
function X_connectDatabase(&$connection){
    $db= X_config::$_database_login;
    if($db && is_array($db)){
        if(is_array(current($db))){
            foreach ($db as $key=>$login){
                switch($login['engine']){
                    case "mysql" : default : 
                        $connection[$key]= new X_mysql($login,$key);
                        break;
                }
            }
        }else{
            switch($db['engine']){
                case "mysql" : default : 
                    $connection= new X_mysql($db);
                    break;
            }
        }
    }else{
        $connection= null;
    }
    
}
function X_connectI18N(&$i18n=null,$db=null,&$getLang=null){
    if($db!==null && !empty(X_config::$i18n_db_table)){
        $i18n= new X_i18n($db,$getLang);
    }
    X_options::$i18n= &$i18n;
}
function __($text,$replace=null){
    if(method_exists(X_options::$i18n, "__")){
        return X_options::$i18n->__($text,$replace);
    }else{
        if($replace!==null){
            if(is_array($replace)){
                foreach($replace as $key=>$str){
                    $text= preg_replace("#%".preg_quote($key,"#")."%#",$str,$text);
                }
            }else{
                $text= preg_replace("#%.+%#U",$replace,$text);
            }
        }
        return $text;
    }
}
require_once 'version.php';
require_once 'ob.php';
require_once 'autoload.php';
require_once 'plugin.php';
